package cn.xgj.sfzy.service.impl;

import cn.xgj.sfzy.entity.ConsultNotice;
import cn.xgj.sfzy.mapper.ConsultNoticeMapper;
import cn.xgj.sfzy.service.ConsultNoticeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @ClassName consultNoticeServiceImpl
 * @Description TODO
 * @Author xgj
 * @Date 2024年10月21日 14:40
 * @Version 1.0
 */
@Service
public class ConsultNoticeServiceImpl implements ConsultNoticeService {

    @Autowired
    private ConsultNoticeMapper consultNoticeMapper;

    @Override
    public int add(ConsultNotice consultNotice) {
        return consultNoticeMapper.insert(consultNotice);
    }

    @Override
    public int edit(ConsultNotice consultNotice) {
        return consultNoticeMapper.update(consultNotice);
    }

    @Override
    public int remove(Integer id) {
        return consultNoticeMapper.delete(id);
    }

    @Override
    public List<ConsultNotice> findAll(ConsultNotice consultNotice) {
        return consultNoticeMapper.find(consultNotice);
    }

    @Override
    public ConsultNotice findById(Integer id) {
        return consultNoticeMapper.findById(id);
    }

    @Override
    public PageInfo<ConsultNotice> findByPage(Integer pageNum, Integer pageSize, ConsultNotice consultNotice) {
        PageHelper.startPage(pageNum,pageSize);
        List<ConsultNotice> list = consultNoticeMapper.find(consultNotice);
        PageInfo<ConsultNotice> info = new PageInfo<ConsultNotice>(list);
        return info;
    }

}

